package com.heze.utils;

import org.junit.Test;

import java.util.UUID;

/**
 * @author 何泽
 * @version 1.0
 */

@SuppressWarnings("all")    //抑制警告
public class IDutils {

    public static int getId(){
        Integer uuid=UUID.randomUUID().toString().replaceAll("-","").hashCode();
        uuid = uuid < 0 ? -uuid : uuid;//String.hashCode() 值会为空
        return uuid;
    }

    @Test
    public void test(){
        System.out.println(IDutils.getId());
    }
}
